#include <func.h>

int main(int argc,char *argv[])
{
    int ret;
    char buf[20]={0};
    int epfd=epoll_create(1);
    struct epoll_event event,evlist[1];
    event.data.fd=STDIN_FILENO;
    event.events=EPOLLIN;
    ret=epoll_ctl(epfd,EPOLL_CTL_ADD,STDIN_FILENO,&event);
    int ready;
    while(1)
    {
        ready=epoll_wait(epfd,evlist,1,-1);
        ERROR_CHECK(ready,-1,"epoll_wait");
        if(ready>0&&event.data.fd==STDIN_FILENO)
        {
            read(STDIN_FILENO,buf,sizeof(buf));
            write(STDOUT_FILENO,buf,strlen(buf));
        }
    }
    return 0;
}

